<?php

$file = "fifo_x";
if (!posix_access($file,POSIX_F_OK)){
    if (posix_mkfifo($file,0666)){
        fprintf(STDOUT,"create ok\n");
    }
}
$fd = fopen($file,"r+");
stream_set_blocking($fd,0);
while (1){
  $data =  fread($fd,128);
  if ($data){
      fprintf(STDOUT,"pid=%d recv:%s\n",getmypid(),$data);
  }
}
fclose($fd);